<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/Schedule">
		<table border="10px">
			<tbody>
			<tr>
				<th>Course Name</th>
				<th>Day</th>
				<th>Begin</th>
				<th>End</th>
			</tr>
				<xsl:apply-templates select="Course"/>
			</tbody>	
		</table>
	</xsl:template>

	<xsl:template match="/Schedule/Course">
		<tr>
			<td><xsl:value-of select="Name"/></td>
		</tr>
		<xsl:apply-templates select="Session"/>
	</xsl:template>
	<xsl:template match="/Schedule/Course/Session">
		<tr>
			<td></td>
			<td>
				<xsl:call-template name="num2day">
					<xsl:with-param name="num" select="Day"/>
				</xsl:call-template>
			</td>
			<td><xsl:value-of select="BeginTime"/>:00</td>
			<td><xsl:value-of select="EndTime"/>:00</td>
		</tr>
	</xsl:template>

	<xsl:template name="num2day">
		<xsl:param name="num"/>
			<xsl:choose>
				<xsl:when test="$num=1">Sunday</xsl:when>
				<xsl:when test="$num=2">Monday</xsl:when>
				<xsl:when test="$num=3">Tuesday</xsl:when>
				<xsl:when test="$num=4">Wednesday</xsl:when>
				<xsl:when test="$num=5">Thursday</xsl:when>
				<xsl:when test="$num=6">Friday</xsl:when>
				<xsl:when test="$num=7">Saterday</xsl:when>
			</xsl:choose>
	</xsl:template>
	
</xsl:stylesheet>
